const express = require('express')
const router = express.Router()

const article_handler = require('../router_handler/article')

// 导入解析 formdata 格式表单数据的包
const multer = require('multer')
// 导入处理路径的核心模块
const path = require('path')

const upload = multer({
    dest: path.join(__dirname, '../uploads')
})

const expressJoi = require('@escook/express-joi')

const { addArticle } = require('../ValidationRules/user')

router.post('/add',upload.single('cover_img'),expressJoi(addArticle),article_handler.addArticle)

module.exports = router